package com.lzc.blog.controller;

import com.lzc.blog.service.CategoryService;
import com.lzc.blog.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 文章分类
 */
@RestController
@RequestMapping("/categorys")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    /**
     *
     * @return
     */
    @GetMapping
    public Result categories(){
        return categoryService.findAll();
    }

    /**
     * 查询所有分类
     * @return
     */
    @GetMapping("/detail")
    public Result categoriesDetail(){
        return categoryService.findAllDetail();
    }

    /**
     * 根据分类id查
     * @param id
     * @return
     */
    @GetMapping("/detail/{id}")
    public Result categoryDetailById(@PathVariable Long id){
        return categoryService.findAllDetailById(id);
    }
}
